 q = list(input('введите скобочную последовательность: '))
 stack = []
 ans = True
 for i in q:
     if i == '(' or i == '(' or i == '(' or i == '<':
         stack.append(i)
     elif stack != [] and (i == ')' and stack[-1] == '(' or i == ']' and stack[-1] == '[' or i == '}' and   stack[-1] == '{' or i == '>' and stack[-1] == '<'):
         stack.pop()
     elif stack == [] and (i == ')' or i == '}' or i == '>'):
         ans = False
if stack != [] or ans == False:
    print("False")
else:
    print('True')